﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using UFSControl.Resources;

namespace UFSControl
{
    public partial class MainForm : Form
    {
        private RemoteSender vSender;

        public MainForm()
        {
            InitializeComponent();
            vSender = new RemoteSender();
        }


        private void imageButton_Click(object sender, EventArgs e)
        {
            ImageButton button;
            if (sender is ImageButton)
            {
                button = (ImageButton)sender;
                string lCode = "";
                //unterstützte Kommandos
                //1 2 3 4 5 6 7 8 9 0 p+ p- vol+ vol- mute info up down left right 
                //fav pip opt tvr epg archiv media exit ok stop rec play pause fback fforward 
                //help standby menu text
                switch (button.Tag.ToString())
                {
                    case "1"    : lCode = "1"; break;
                    case "2"    : lCode = "2"; break;
                    case "3"    : lCode = "3"; break;
                    case "4"    : lCode = "4"; break;
                    case "5"    : lCode = "5"; break;
                    case "6"    : lCode = "6"; break;
                    case "7"    : lCode = "7"; break;
                    case "8"    : lCode = "8"; break;
                    case "9"    : lCode = "9"; break;
                    case "0"    : lCode = "0"; break;
                    case "menu" : lCode = "menu"; break;
                    case "text" : lCode = "text"; break;
                    case "v+"   : lCode = "vol+"; break;
                    case "v-"   : lCode = "vol-"; break;
                    case "p+"   : lCode = "p+"; break;
                    case "p-"   : lCode = "p-"; break;
                    case "mute" : lCode = "mute"; break;
                    case "info" : lCode = "info"; break;
                    case "left" : lCode = "left"; break;
                    case "right": lCode = "right"; break;
                    case "up"   : lCode = "up"; break;
                    case "down" : lCode = "down"; break;

                    case "fav"  : lCode = "fav"; break;
                    case "pip"  : lCode = "pip"; break;
                    case "opt"  : lCode = "opt"; break;
                    case "tvr"  : lCode = "tvr"; break;
                    case "epg"  : lCode = "epg"; break;
                    case "archiv": lCode = "archiv"; break;
                    case "media": lCode = "media"; break;
                    case "back" : lCode = "exit"; break;
                    case "ok"   : lCode = "ok"; break;
                    case "stop" : lCode = "stop"; break;
                    case "rec"  : lCode = "rec"; break;
                    case "play" : lCode = "play"; break;
                    case "pause": lCode = "pause"; break;
                    case "fback": lCode = "fback"; break;
                    case "ffor" : lCode = "fforward"; break;
                    case "help" : lCode = "help"; break;
                    case "standby": lCode = "standby"; break;
                 }
                vSender.SendCode(lCode);
            }


        }

        private void beendenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            System.Windows.Forms.Application.Exit();
        }

        private void überToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AboutBox lbox = new AboutBox();
            lbox.ShowDialog();
        }

        private void eigenschaftenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            setting lSettings = new setting();
            lSettings.ShowDialog();
        }

        private void senderlisteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ProgrammList lChannelForm = new ProgrammList(new Point((Location.X + Width),(Location.Y)));
            lChannelForm.Show(); 
        }

        private void infoToolStripMenuItem_Click(object sender, EventArgs e)
        {
           DeviceInfo lDeviceInfoForm = new DeviceInfo();
            lDeviceInfoForm.ShowDialog();
        
        }

        private void aufnahmeplanToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TimerList lTimerListForm = new TimerList();
            lTimerListForm.ShowDialog();
        }

        private void archivToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ArchivList lArchivListForm = new ArchivList();
            lArchivListForm.ShowDialog();
        }

        private void changeProgrammListClick(object sender, EventArgs e)
        {
            channelList lchannelList = new channelList();
            lchannelList.ShowDialog();
        }

        private void deviceInfoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            deviceTelnetInfo ldeviceInfo = new deviceTelnetInfo();
            ldeviceInfo.ShowDialog();
        }


    }
}
